<?php
namespace app\admin\controller;

use think\Controller;
use think\Session;
use think\Db;

class Comment extends Controller
{
    public function index () {
        $this->checkLogin();
        $result = Db::table('comment')
        ->alias('c')
        ->join('publish p','c.publish_id = p.publish_id')
        ->join('users u','c.user_id = u.user_id')
        ->select();
        // dump($result);
        $this->assign('list', $result);
        return $this->fetch('list');
    }

    public function delect()//删除评论方法
    {
        $this->checkLogin();
        $request=input('comment_id');
        if (Db::table("comment")->delete($request)){
            $this->success("删除成功");
        }
        else{
            $this->error("删除失败");
        }
    }
}